package com.gin.kotlin.no_gay_alliance.database.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.gin.kotlin.no_gay_alliance.database.entity.EmojiHistory

@Dao
interface EmojiHistoryDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun add(emojiHistory: EmojiHistory)

    @Query("select * from EmojiHistory where code=:code")
    fun get(code: String): EmojiHistory?

    @Query("select * from EmojiHistory order by count desc limit :limit")
    fun listByCount(limit: Int = 20): List<EmojiHistory>?

    @Query("select * from EmojiHistory order by timestamp desc limit :limit")
    fun listByTimestamp(limit: Int = 20): List<EmojiHistory>?
}